PROCEDURE (VAR f: Formatter) WriteMsg (msg: ARRAY OF CHAR)
END;
PROCEDURE IsQualIdent (VAR s: ARRAY OF CHAR): BOOLEAN;
PROCEDURE ScanQualIdent (VAR s: Scanner; VAR x: ARRAY OF CHAR; VAR done: BOOLEAN);
END TextMappers.
TextMappers are mappers that use text riders to scan and format structured text.
CONST returnLChars
Option element
Possible element of Scanner.opts. If present, the scanner will return long characters; otherwise long characters are projected to TextModels.unicode.
CONST returnCtrlChars
Option element
Possible element of Scanner.opts. If present, the scanner will return tab, line, and para characters; otherwise these control characters are treated as white space and read over.
CONST returnQualIdents
Option element
Possible element of Scanner.opts. If present, the scanner will return "qualified identifiers" as a single string; otherwise, the name and period parts of the qualified identifier will be returned individually. (A qualified string, as defined by the language Oberon follows the syntax name ["." name].)
CONST returnViews
Option element
Possible element of Scanner.opts. If present, the scanner will return embedded views; otherwise these are treated as white space and read over.
CONST interpretBools
Option element
Possible element of Scanner.opts. If present, the scanner will recognize boolean truth values "$TRUE" and "$FALSE", as output by the formatter when writing Boolean values; otherwise "$", "TRUE", and "FALSE" are returned individually, without interpretation.
CONST interpretSets
Option element
Possible element of Scanner.opts. If present, the scanner will recognize set values: sets of integers in the range MIN(SET) .. MAX(SET) as defined by the language Oberon; otherwise "{", ".", and enclosed integers will be returned individually. (The syntax of set values is {" integer [".." integer "]" { "," integer [".." integer] "}.)
CONST maskViews
Option element
Possible element of scanner.opts. If present, the scanner will try to interpret a view as a character code, if the view has a preferred character code. Otherwise, the view is returned.
CONST char
Possible value of scanner.type, signalling that a plain character has been scanned. A character is returned in this class if it does not form a valid first character of any of the structured scan types below.
CONST lchar
Possible value of scanner.type, signalling that a long character has been scanned.
CONST string
Possible value of scanner.type, signalling that a string has been scanned.
CONST lstring
Possible value of scanner.type, signalling that a long string has been scanned.
CONST int
Possible value of scanner.type, signalling that an integer has been scanned.
CONST real
Possible value of scanner.type, signalling that a real has been scanned.
CONST bool
Possible value of scanner.type, signalling that a Boolean has been scanned.
CONST set
Possible value of scanner.type, signalling that a set has been scanned.
CONST view
Possible value of scanner.type, signalling that an embedded view has been scanned.
CONST tab
Possible value of scanner.type, signalling that a tab character has been scanned.
CONST line
Possible value of scanner.type, signalling that a line character has been scanned.
CONST para
Possible value of scanner.type, signalling that a para character has been scanned.
CONST eot
Possible value of scanner.type, signalling that the most recent call to Scan hit the end of the text.
CONST invalid
Possible value of scanner.type, signalling that the most recent call to Scan encountered a syntactically ill formed sequence.
CONST charCode
Possible value for parameter base of formatter.WriteIntForm, asking for formatting integers following the syntax of Oberon numerical character literals. (For example, 0DX is the code for line, and 37X the code for "7".)
CONST decimal
Possible value for parameter base of formatter.WriteIntForm, asking for formatting integers as decimal literals.
CONST hexadecimal
Possible value for parameter base of formatter.WriteIntForm, asking for formatting integers as hexadecimal literals.
CONST hideBase
Possible value for parameter showBase of formatter.WriteIntForm, asking for suppresion of the base indicator.
CONST showBase
Possible value for parameter showBase of formatter.WriteIntForm, asking for output of the base indicator.
TYPE LONGCHAR
Type of long characters.
TYPE String
Strings of characters as detectable by scanners.
TYPE LongString
Strings of long characters as detectable by scanners.
TYPE Scanner
Scanners are connectable to texts. They allow to scan the sequence of characters and embedded views which form a text for recognized structured subsequences (symbols). The various symbols that a scanner can recognize are defined in terms of scan types (cf. the constants above).
opts-: SET
The scanning options, drawn from the set {returnLChars, returnCtrlChars, returnQualIdents, returnViews, interpretBools, interpretSets, maskViews}.
rider-: TextModels.Reader
The rider connecting the scanner to the text. The rider state is used by the scanner as a single element look
ahead buffer. A sequence of rider.Read or rider.ReadPrev, or positioning the rider followed by rider.Read are all legal manipulations of that look
ahead state.
type: INTEGER
Type of symbol scanned most recently.
start: LONGINT
Starting position of the symbol scanned most recently. Set by scanner.Scan after skipping initial white space.
lines, paras: LONGINT
Number of lines (line characters) and paragraphs (para characters) passed by the scanner since being connected. Updated by scanner.Skip (called initially in scanner.Scan) when skipping white space.
char: CHAR valid if type = char
Character scanned most recently.
lchar: LONGCHAR valid iff type IN {char, lchar}
Long character scanned most recently.
int, base: LONGINT valid iff type = int
Integer scanned most recently, and the base that was used for its formatting. The string representation of the scanned integer is available in (len, string) after scanning.
real: LONGREAL valid iff type = real
Real scanned most recently.
bool: BOOLEAN valid iff type = bool
Boolean scanned most recently.
set: SET valid iff type = set
Set scanned most recently.
len: INTEGER valid iff type IN {string, lstring, int}
Length of string or lstring field, depending on type.
string: String valid iff type IN {string, int, bool}
String of characters scanned most recently.
lstring: LongString valid iff type IN {string, lstring}
String of long characters scanned most recently.
view: Views.View; w, h: LONGINT valid iff type = view
View scanned most recently, and its width and height.
Write integer x. The numeral string used to represent the number is relative to base base. The total representation form will at least have a width of minWidth characters, where padding (if required) takes place to the left using characters as specified by fillCh. If non
decimal, the base can be requested to form part of the representation using showBase. The special value base = charCode renders the base suffix "X", while base = hexadecimal renders the suffix "H". All other non
decimal bases are represented by a trailing "%" followed by the decimal numerical literal representing the base value itself. Non
decimal representations of negative integers are formed using a base
complement form of width minWidth. E.g., x = -3 renders for base = 16 and minWidth = 2 as "FD".
Write a parameterized message string mapped by the Dialog.MapParamString facility. The resulting string is allowed to contain line, para and tab characters, all of which will be written as such.
f.rider # NIL (not explicitly checked)
PROCEDURE (VAR f: Formatter) WriteMsg (msg: ARRAY OF CHAR)
Write a message string mapped by the Dialog.MapParamString facility.
Except for performace, equivalent to:
f.WriteParamMsg(msg, "", "", "")
PROCEDURE IsQualIdent (VAR s: ARRAY OF CHAR): BOOLEAN
Test whether the string s fulfills the syntax of an Oberon qualident, i.e. ident ["." ident].
PROCEDURE ScanQualIdent (VAR s: Scanner; VAR x: ARRAY OF CHAR;
VAR done: BOOLEAN)
Assuming that the scanner returned a string, check if the succeeding symbols can be consumed to scan a qualident. If the scanned string is not a qualident, the scanner is reset the position it had before the call to ScanQualIdent.